package com.start.ad.api;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.start.ad.service.StartAdContentService;
import com.start.ad.vo.StartAdContentVo;
import com.start.common.api.Result;
import com.start.common.dataRule.DataQueryConstructor;
import com.start.security.annotations.IgnoreAuth;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("start/adApi")
public class StartAdApiController {
    @Autowired
    private StartAdContentService startAdContentService;

    @IgnoreAuth
   @Operation(summary = "分页查询广告")
    @GetMapping("/pageAdContent")
    public Result<?> pageAdContent(Page<StartAdContentVo> page) {
        LambdaQueryWrapper<StartAdContentVo> queryWrapper = DataQueryConstructor.createEntity(StartAdContentVo.class).lambda();
        return Result.ok(startAdContentService.pageAdContent(page, queryWrapper));
    }
    @IgnoreAuth
   @Operation(summary = "列表查询广告")
    @GetMapping("/listAdContent")
    public Result<?> listAdContent() {
        LambdaQueryWrapper<StartAdContentVo> queryWrapper = DataQueryConstructor.createEntity(StartAdContentVo.class).lambda();
        return Result.ok(startAdContentService.listAdContent(queryWrapper));
    }
}
